Utility.CreateClass('Alex.Library.Web.Ajax.Samples.TestClass', {
    Option: {
        RequestType: 'GET',
        RequestURL: 'WAjax.aspx',
        IsAsync: true,
        ReturnType: 'json',
        BeforeSendHandler: function () { },
        CompleteHandler: function () { },
        ErrorHandler: function (XMLHttpRequest, status) { }
    },
    ResetOption: function () {
        this.Option = {
            RequestType: 'GET',
            RequestURL: 'WAjax.aspx',
            IsAsync: true,
            ReturnType: 'json',
            BeforeSendHandler: function () { },
            CompleteHandler: function () { },
            ErrorHandler: function (XMLHttpRequest, status) { }
        }
    },
    GetTestObjects: function (__obj, callback) {
        var option = this.Option;
        $.ajax({
            type: option.RequestType,
            async: option.IsAsync,
            data: {
                __assembly: 'App_Code.8hrp3s_j, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null',
                __class: 'Alex.Library.Web.Ajax.Samples.TestClass',
                __method: 'GetTestObjects',
                __temp: Math.random(),
                __returntype: option.ReturnType
, obj: escape($.toJSON(__obj) + '::Alex.Library.Web.Ajax.Samples.TestObject')
            },
            dataType: option.ReturnType,
            url: option.RequestURL,
            beforeSend: option.BeforeSendHandler,
            success: callback,
            complete: option.CompleteHandler,
            error: option.ErrorHandler
        });
    },
    SaveObjects: function (__objs, callback) {
        var option = this.Option;
        $.ajax({
            type: option.RequestType,
            async: option.IsAsync,
            data: {
                __assembly: 'App_Code.8hrp3s_j, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null',
                __class: 'Alex.Library.Web.Ajax.Samples.TestClass',
                __method: 'SaveObjects',
                __temp: Math.random(),
                __returntype: option.ReturnType
, objs: escape($.toJSON(__objs) + '::System.Collections.Generic.List`1[[Alex.Library.Web.Ajax.Samples.TestObject, App_Code.8hrp3s_j, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]')
            },
            dataType: option.ReturnType,
            url: option.RequestURL,
            beforeSend: option.BeforeSendHandler,
            success: callback,
            complete: option.CompleteHandler,
            error: option.ErrorHandler
        });
    },
    TestStaticMethod: function (callback) {
        var option = this.Option;
        $.ajax({
            type: option.RequestType,
            async: option.IsAsync,
            data: {
                __assembly: 'App_Code.8hrp3s_j, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null',
                __class: 'Alex.Library.Web.Ajax.Samples.TestClass',
                __method: 'TestStaticMethod',
                __temp: Math.random(),
                __returntype: option.ReturnType
            },
            dataType: option.ReturnType,
            url: option.RequestURL,
            beforeSend: option.BeforeSendHandler,
            success: callback,
            complete: option.CompleteHandler,
            error: option.ErrorHandler
        });
    }
});
